home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-01-19 | 2.7 KB | 99 lines | [TEXT/MPS ] |
- MK
- ==
-
- A template maker. © G. Sawitzki 1988, 1992
-
- Syntax: mk [-v] [-<type>] <name> <var list>
- The interpretation of parameters is position dependent.
-
- -v verbose
- -<type> admissible types depend on templates loaded in resource branch.
- Type mk to see a list of the templates installed ant their parameters.
- <name> Base name of the file to be generated. Extension depends on <type>.
- <var list> strings to be used for substitution.
-
-
- A file <name>.<extension> is generated and filled with the information of <type>, where
- the strings in <var list> are substituted in a <type> template.
- "Open <name>.<extension>" is written to diagnostic.
-
-
-
- Error conditions:
-
- (1) Syntax error
- (2) Expanded template too big
- (3) Resource branch corrupt.
- mk (without any parameters) will dump a list of the available templates,
- together with their parameters.
-
-
- Operation:
-
- mk looks for a string list with name <type> in its resource fork. This string list is
- interpreted as follows:
- string 1: file extension for a file to create. mk creates <name>.<extension>
- string 2: name of a TEXT resource to use as a template.
- string 3ff: strings to be substituted in template.
- <name> is substituted for the first string in the string list
- subsequent parameters of the var list are substituted by order.
-
- String list 128 is used as a default if no <type> is given.
-
-
- Templates installed in the distribution version are:
-
- -prog MPW Pascal Program (default)
- -unit MPW Pascal Unit
- -tool MPW Pascal Tool.
-
- Examples:
- mk # gives an error message, and a list of available templates
- mk test # generates a program code template called test.p
- mk -tool myTool # generates a code template myTool.p for a tool
-
-
-
-
-
-
- 3.12.1988 gs
- =============
- 19. 1. 1992 moved resources to .rsrc file, discarded templates in .r file.
- TEXT resources are now supported by ResEdit, so templates can be accessed by ResEdit.
-
-
- To generate a new resource file from templates stored in text files, use
- Rez with a script like in the following example:
- #include "Types.r"
- /*
- Resources for make
- STR# resource name is the name of a type
- first entry in STR# is the file extension for the file to create,
- second entry is the name of a TEXT resource.
- The following entries are strings to be substituted
- by position.
- */
-
- /* default list. must have id 128 */
- resource 'STR#' (128, "MAIN", preload) {
- { ".p","PROG","program_name"}
- };
-
- /* other lists */
- resource 'STR#' (23542, "tool", preload) {
- { ".p","TOOL","tool_name"}
- };
-
- resource 'STR#' (27045, "unit", preload) {
- { ".p","UNIT","unit_name"}
- };
-
- resource 'STR#' (25441, "prog", preload) {
- { ".p","PROG","program_name"}
- };
-
- read 'TEXT' (256,"PROG") "prog.text";
- read 'TEXT' (257,"UNIT") "unit.text";
- read 'TEXT' (258,"TOOL") "tool.text";
-